<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>科室管理页面</title>
    <link rel="stylesheet" href="../css/office.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/office.js"></script>
</head>
<body>
<!--科室操作界面-->
<div class="ofiice-oper">
    <button id="office-oper-add">新增信息</button>
</div>
<hr/>
<!--历史信息显示界面-->
<div class="office-information-show">
    <table id="tb_office" cellspacing="0" cellpadding="2" width="100%" border="1">
        <tr align="center" bgcolor="#dcdcdc">
            <td style="width:100px;">序号</td>
            <td style="width: 250px">科室编号</td>
            <td>科室名称</td>
            <td>备注</td>
            <td>操作</td>
        </tr>
        <!--<tr align="center">-->
            <!--<td style="width:100px;">1</td>-->
            <!--<td style="width: 250px">001</td>-->
            <!--<td>外科</td>-->
            <!--<td>外科包括。。。。</td>-->
            <!--<td>-->
                <!--<button data-id="" class="officeInformationUpdateBtn">编辑</button>-->
                <!--<button data-id="" class="officeInformationCancelBtn">删除</button>-->
            <!--</td>-->
        <!--</tr>-->
    </table>
</div>

<!--新增信息界面-->
<div class="add-new-office">
    <div>
        <label for="officeNumInput">科室编号</label>
        <input class="officeAddInput" id="officeNumInput" placeholder="请输入科室编号">
    </div>
    <div>
        <label for="officeNameInput">科室名称</label>
        <input class="officeAddInput" id="officeNameInput" placeholder="请输入科室名称">
    </div>
    <div>
        <label for="officeRemark">备注</label>
        <input class="officeAddInput" id="officeRemarkInput" placeholder="请输入备注信息">
    </div>
    <div class="add-new-office-button">
        <button id="officeAddSureBtn">确认</button>
        <button id="officeAddBackBtn">返回</button>
    </div>
</div>
<!--编辑框弹出界面-->
<div class="office-update">
    <div>
        <label for="officeNum">科室编号</label>
        <input type="text" class="office" id="officeNum" placeholder="">
    </div>
    <div>
        <label for="officeName">科室名称</label>
        <input type="text" class="office" id="officeName" placeholder="">
    </div>
    <div>
        <label for="officeRemark">备注</label>
        <input type="text" class="office" id="officeRemark" placeholder="">
    </div>
    <div>
        <button id="officeUpdateGetInfoSureBtn">确认</button>
        <button id="officeUpdateGetInfoBackBtn">返回</button>
    </div>
</div>
<div id="over"></div>
<!--表格宽度可伸缩事件-->
<script type="text/javascript">
    var tTD; //用来存储当前更改宽度的Table Cell,避免快速移动鼠标的问题
    var table = document.getElementById("tb_office");
    for (j = 0; j < table.rows[0].cells.length; j++) {
        table.rows[0].cells[j].onmousedown = function () {
//记录单元格
            tTD = this;
            if (event.offsetX > tTD.offsetWidth - 10) {
                tTD.mouseDown = true;
                tTD.oldX = event.x;
                tTD.oldWidth = tTD.offsetWidth;
            }
//记录Table宽度
//table = tTD; while (table.tagName != ‘TABLE') table = table.parentElement;
//tTD.tableWidth = table.offsetWidth;
        };
        table.rows[0].cells[j].onmouseup = function () {
//结束宽度调整
            if (tTD == undefined) tTD = this;
            tTD.mouseDown = false;
            tTD.style.cursor = 'default';
        };
        table.rows[0].cells[j].onmousemove = function () {
//更改鼠标样式
            if (event.offsetX > this.offsetWidth - 10)
                this.style.cursor = 'col-resize';
            else
                this.style.cursor = 'default';
//取出暂存的Table Cell
            if (tTD == undefined) tTD = this;
//调整宽度
            if (tTD.mouseDown != null && tTD.mouseDown == true) {
                tTD.style.cursor = 'default';
                if (tTD.oldWidth + (event.x - tTD.oldX) > 0)
                    tTD.width = tTD.oldWidth + (event.x - tTD.oldX);
//调整列宽
                tTD.style.width = tTD.width;
                tTD.style.cursor = 'col-resize';
//调整该列中的每个Cell
                table = tTD;
                while (table.tagName != 'TABLE') table = table.parentElement;
                for (j = 0; j < table.rows.length; j++) {
                    table.rows[j].cells[tTD.cellIndex].width = tTD.width;
                }
//调整整个表
//table.width = tTD.tableWidth + (tTD.offsetWidth – tTD.oldWidth);
//table.style.width = table.width;
            }
        };
    }
</script>
</body>
</html>